
<style>
    #device_Update_div label {
        width: 150px;
        /*    background-color: #dddddd;*/
    }

    .layui-form-pane .layui-input-block {
        margin-left: 150px;
        left: -1px;
    }

    #device_Update_div div.layui-form-item {
        margin-bottom: 5px;
    }

    #device_Update_div fieldset {
        padding-bottom: 2px;
    }

    #device_Update_div div.layui-tab-content {
        height: 550px;
    }

    .selectUp .layui-form-select dl {
        top: auto;
        bottom: 36px;
    }

    .layui-form-item .layui-input-inline {
        width: 250px;
    }
</style>
<div class="layui-form layuimini-form  layui-form-pane" id="device_Update_div" lay-filter="device_Update_div_filter">
    <div class="layui-panel" style="height:600px;">
        <div class="layui-tab">
            <ul class="layui-tab-title">
                <li class="layui-this"> 系统设置</li>
                <li> 门禁设置</li>
                <li> 人脸识别</li>
                <li> 网络参数</li>
                <li> 其他</li>
                <li> 状态</li>
                <li> 设备存储详情</li>
            </ul>

            <div class="layui-tab-content">
                <!-- 系统设置 -->
                <div class="layui-tab-item layui-show" id="device_Update_Page1">


                    <fieldset class="table-search-fieldset">
                        <legend> 设备身份</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 设备SN</label>
                                    <div class="layui-input-inline">
                                        <input type="text" maxlength="16"
                                               name="deviceSn" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入设备SN" lay-reqText="请输入设备SN"
                                               tipShow="1" tipMsg="设备SN由16个字符组成,必填">
                                        <input type="text" class="layui-input layui-hide" name="id" id="id" />
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 设备名称</label>
                                    <div class="layui-input-inline">
                                        <input type="text" maxlength="30" name="deviceName" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入设备名称" lay-reqText="请输入设备名称"
                                               tipShow="1" tipMsg="设备名称，最长30个字符,必填">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 版本号</label>
                                    <div class="layui-input-inline ">
                                        <input type="text" disabled name="vVer" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 制造商</label>
                                    <div class="layui-input-inline">
                                        <input type="text" maxlength="50" name="makerName" autocomplete="off" class="layui-input"
                                               tipShow="1" tipMsg="制造商信息 最长50个字符,可为空">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 网址</label>
                                    <div class="layui-input-inline">
                                        <input type="text" maxlength="50" name="makerUrl" autocomplete="off" class="layui-input"
                                               tipShow="1" tipMsg="制造商网址信息 最长50个字符,可为空">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 生产日期</label>
                                    <div class="layui-input-inline">
                                        <input type="text" maxlength="20" name="makerDate" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入生产日期" lay-reqText="请输入生产日期"
                                               tipShow="1" tipMsg="设备生产日期 必填">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 设备时区</label>
                                    <div class="layui-input-inline">
                                        <input type="text" maxlength="20" name="time" autocomplete="off" class="layui-input"
                                               tipShow="1" tipMsg="公司名称 最长20个字符,可为空">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 菜单密码</label>
                                    <div class="layui-input-inline">
                                        <input type="text" maxlength="8" name="menuPassword" autocomplete="off" class="layui-input"
                                               tipShow="1" tipMsg="菜单密码 由4-8位数字组成<br/>仅支持数字，可为空">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> Token</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="token" autocomplete="off" class="layui-input"
                                               tipShow="1" tipMsg="与设备通讯的通讯密码">
                                    </div>
                                </div>
                            </div>
                            <!--<div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">主机</label>
                                    <div class="layui-input-inline">
                                        <input type="text" maxlength="20" name="parameterCompanyName" autocomplete="off" class="layui-input"
                                               tipShow="1" tipMsg="主从机模式时使用，默认主机">
                                    </div>
                                </div>
                            </div>-->
                        </div>

                    </fieldset>
                    <fieldset class="table-search-fieldset">
                        <legend>灯光图像</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">补光灯</label>
                                    <div class="layui-input-inline selectUp">
                                        <select name="light" required lay-verify="">
                                            <option value="0" selected>常闭</option>
                                            <option value="1">常开</option>
                                            <option value="2">自动</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 曝光设置</label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="3" min="-3" name="exposure" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入曝光设置" lay-reqText="请输入曝光设置"
                                               tipShow="1" tipMsg="曝光设置 取值范围 -3 -- 3,整数，必填">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 红外图像</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="ir" lay-skin="switch" lay-text="开启|关闭" unchecked value="1">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 屏幕亮度</label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="10" min="1" name="brightness" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入屏幕亮度" lay-reqText="请输入屏幕亮度"
                                               tipShow="1" tipMsg="屏幕亮度 取值范围 1 -- 10,整数，必填">
                                    </div>
                                </div>

                            </div>
                        </div>

                    </fieldset>
                    <fieldset class="table-search-fieldset">
                        <legend> 声音及文字</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 语言</label>
                                    <div class="layui-input-inline selectUp">
                                        <select name="language" required lay-verify="">
                                            <option value="1" selected>中文</option>
                                            <option value="2">英文</option>
                                            <option value="3">繁体</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 音量</label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="10" min="1" maxlength="2" name="volume" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入音量" lay-reqText="请输入音量"
                                               tipShow="1" tipMsg="音量大小 取值范围 0 -- 10，必填">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 语音播报</label>
                                    <div class="layui-input-inline selectUp">
                                        <select name="speek" required lay-verify="">
                                            <option value="0">不播报</option>
                                            <option value="1">播放名字</option>
                                            <option value="2">播放问候语</option>
                                            <option value="3" selected>播Speek放名字和问候语</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 问候语</label>
                                    <div class="layui-input-inline selectUp">
                                        <select name="grettings" required lay-verify="">
                                            <option value="0" selected>请通行</option>
                                            <option value="1">欢迎光临</option>
                                            <option value="2">时间问候语</option>
                                            <option value="3">消费登记成功</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 陌生人语音</label>
                                    <div class="layui-input-inline selectUp">
                                        <select name="strangerVoice" required lay-verify="">
                                            <option value="0">不播报</option>
                                            <option value="1">播报假体</option>
                                            <option value="2" selected>播报陌生人</option>
                                            <option value="3">播报假体和陌生人</option>
                                        </select>

                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 公司名称</label>
                                    <div class="layui-input-inline">
                                        <input type="text" maxlength="30"
                                               name="companyName" autocomplete="off" class="layui-input"
                                               placeholder="请输入公司名称" lay-reqText="请输入公司名称"
                                               tipShow="1" tipMsg="公司名称长度为30个文字">
                                    </div>
                                </div>
                                <!--<div class="layui-inline">
                                    <label class="layui-form-label"> 设备二维码图片地址</label>
                                    <div class="layui-input-inline">
                                        <input type="text" maxlength="150"
                                               name="qrCodePath" autocomplete="off" class="layui-input"
                                               placeholder="请输入设备二维码图片地址" lay-reqText="请输入设备二维码图片地址"
                                               tipShow="1" tipMsg="设备二维码图片地址长度为150个文字">
                                    </div>
                                </div>-->
                            </div>
                        </div>

                    </fieldset>

                </div>
                <!-- 门禁设置 -->
                <div class="layui-tab-item" id="device_Update_Page2">

                    <fieldset class="table-search-fieldset">
                        <legend> 鉴权参数</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 出入类型</label>
                                    <div class="layui-input-inline">
                                        <input type="radio" name="door" value="0" title="入门" checked>
                                        <input type="radio" name="door" value="1" title="出门">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 免验证开门</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="free" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 重复验证开门</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="repeatUse" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>

                                <div class="layui-inline">
                                    <label class="layui-form-label"> 识别间隔（秒）</label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="65535" min="0" name="repeatInterval" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入识别间隔" lay-reqText="请输入识别间隔时间"
                                               tipShow="1" tipMsg="识别间隔时间，必填<br/> 取值范围 0 -- 65535(s)，单位：秒">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">响应模式</label>
                                    <div class="layui-input-inline">
                                        <div class="layui-input-inline selectUp">
                                            <select name="repeatMode" required>
                                                <option value="1">记录事件，不开门，有提示</option>
                                                <option value="2">不记录事件，不开门，有提示</option>
                                                <option value="3">不做响应，无提示</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </fieldset>
                    <fieldset class="table-search-fieldset">
                        <legend> 输入输出</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">

                                <div class="layui-inline">
                                    <label class="layui-form-label"> WG输出功能</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="wgUse" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> WG格式</label>
                                    <div class="layui-input-inline">
                                        <select name="cardBytes" required lay-verify="">
                                            <option value="0">禁用</option>
                                            <option value="3">WG26</option>
                                            <option value="4">WG34</option>
                                            <option value="8">WG66</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> WG字节顺序</label>
                                    <div class="layui-input-inline">
                                        <select name="wgOrder" required lay-verify="">
                                            <option value="1">1--高位在前低位在后</option>
                                            <option value="2">2--低位在前高位在后</option>
                                        </select>
                                    </div>
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 输出数据类型</label>
                                    <div id="divparameterWgFormat" class="layui-input-inline">
                                        <input type="radio" name="wgType" value="1" title="用户号">
                                        <input type="radio" name="wgType" value="2" title="卡号" checked>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 开门保持(秒)</label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="65535" min="0" name="releaseTime" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入开门保持" lay-reqText="请输入开门保持时间"
                                               tipShow="1" tipMsg="开门保持时间，必填<br/>识别后继电器输出的时间<br/> 取值范围 0 -- 65535(s)，单位:秒">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 门磁类型</label>
                                    <div class="layui-input-inline">
                                        <select name="doorSensor" required lay-verify="">
                                            <option value="0">常闭</option>
                                            <option value="1">常开</option>
                                            <option value="2">无</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </fieldset>
                    <fieldset class="table-search-fieldset">
                        <legend> 报警</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">

                                <div class="layui-inline">
                                    <label class="layui-form-label"> 超时报警</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="openTimeoutAlarmUse" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 开门超时(秒)</label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="255" min="5" name="openTimeoutAlarmTimeout" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入开门超时" lay-reqText="请输入开门超时时间"
                                               tipShow="1" tipMsg="开门超时时间，必填<br/>启用【超时报警】功能后，门打开超过此时间后就会报警<br/>取值范围 5 -- 255(s)，单位：秒">
                                    </div>
                                </div>

                                <div class="layui-inline">
                                    <label class="layui-form-label"> 继电器输出</label>
                                    <div class="layui-input-inline">
                                        <select name="openTimeoutAlarm" required lay-verify="">
                                            <option value="0">不输出继电器</option>
                                            <option value="1">输出继电器</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 门磁报警</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="sensorAlarmUse" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </fieldset>

                </div>

                <!-- 人脸识别 -->
                <div class="layui-tab-item" id="device_Update_Page3">
                    <fieldset class="table-search-fieldset">
                        <legend> 人脸检测</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">



                                <div class="layui-inline">
                                    <label class="layui-form-label"> 识别距离</label>
                                    <div class="layui-input-inline">
                                        <select name="distance" required lay-verify="">
                                            <option value="1" selected>近距离（0.2-0.5米）</option>
                                            <option value="2">中距离（0.2-1.5米）</option>
                                            <option value="3">远距离（0.2-1.5米以上）</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="layui-inline">
                                    <label class="layui-form-label"> 识别阈值 </label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="99" min="1" name="faceComparison" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入人脸识别阈值" lay-reqText="请输入人脸识别阈值"
                                               tipShow="1" tipMsg="人脸识别阈值，必填<br/> 取值范围 1 -- 99">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">

                                <div class="layui-inline">
                                    <label class="layui-form-label"> 活体检测</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="bioassay" lay-skin="switch" lay-text="启用|禁用" checked value="1">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 活体阈值 </label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="10" min="1" name="maskThreshold" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入人脸活体检测阈值" lay-reqText="请输入人脸活体检测阈值"
                                               tipShow="1" tipMsg="人脸活体检测阈值，必填<br/> 取值范围 1 -- 10">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </fieldset>
                    <fieldset class="table-search-fieldset">
                        <legend> 口罩检测</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">口罩检测</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="faceMask" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 口罩阈值</label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="99" min="1" name="maskThreshold" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入口罩检测阈值" lay-reqText="请输入口罩检测阈值"
                                               tipShow="1" tipMsg="口罩检测阈值， 取值范围 1 -- 99，必填">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </fieldset>
                    <fieldset class="table-search-fieldset">
                        <legend> 体温检测</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">体温检测</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="bodyTmpUse" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">温度补偿</label>
                                    <div class="layui-input-inline">
                                        <input type="number" min="-1.0" max="1.0" step="0.1" name="bodyTmpCompensate" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入温度补偿值" lay-reqText="请输入温度补偿值"
                                               tipShow="1" tipMsg="温度补偿值，必填<br/>取值范围 -1 -- 1,可输入小数<br/>示例：0.52">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">报警阈值</label>
                                    <div class="layui-input-inline">
                                        <input type="number" min="37.0" max="50.0" step="0.1" name="bodyTmpAlarm" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入高温报警阈值" lay-reqText="请输入高温报警阈值"
                                               tipShow="1" tipMsg="高温报警阈值，必填<br/>取值范围 37 -- 50,可输入小数<br/>单位:摄氏度<br/>示例：37.6">
                                    </div>
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">体温格式</label>
                                    <div class="layui-input-inline">
                                        <input type="radio" name="bodyTmpFormat" value="1" title="摄氏度">
                                        <input type="radio" name="bodyTmpFormat" value="2" title="华氏度" checked>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">显示到屏幕</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="bodyTmpShow" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </fieldset>
                </div>

                <!-- 网络参数 -->
                <div class="layui-tab-item" id="device_Update_Page4">
                    <!--<fieldset class="table-search-fieldset">
                        <legend> webSocket服务器参数</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">

                                <div class="layui-inline">
                                    <label class="layui-form-label"> 服务器地址</label>
                                    <div class="layui-input-inline">
                                        <input type="text" maxlength="100" name="wsServer" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入服务器地址" lay-reqText="请输入服务器地址"
                                               tipShow="1" tipMsg="服务器地址，最长100个字符，必填<br/>示例：http://192.168.1.86:4610/FaceAPI">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 服务器端口</label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="7200" min="5" name="wsPort" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入保活包发包间隔" lay-reqText="请输入保活包发包间隔"
                                               tipShow="1" tipMsg="保活包发包间隔，必填<br/>取值范围： 5 -- 7200，单位：秒">
                                    </div>
                                </div>

                                <div class="layui-inline">
                                    <label class="layui-form-label"> 在线状态</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="wsStatus" lay-skin="switch" disabled="disabled" lay-text="已连接|未连接" unchecked value="1">
                                    </div>
                                </div>


                            </div>
                            <div class="layui-form-item">

                                <div class="layui-inline">
                                    <label class="layui-form-label"> 保活间隔时间</label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="7200" min="5" name="wsKeepalive" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入保活包发包间隔" lay-reqText="请输入保活包发包间隔"
                                               tipShow="1" tipMsg="保活包发包间隔，必填<br/>取值范围： 5 -- 7200，单位：秒">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 连接保持时间</label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="7200" min="5" name="wsKeeptime" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入保活包发包间隔" lay-reqText="请输入保活包发包间隔"
                                               tipShow="1" tipMsg="保活包发包间隔，必填<br/>取值范围： 5 -- 7200，单位：秒">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 重连间隔时间</label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="7200" min="5" name="wsReconnectTime" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入保活包发包间隔" lay-reqText="请输入保活包发包间隔"
                                               tipShow="1" tipMsg="保活包发包间隔，必填<br/>取值范围： 5 -- 7200，单位：秒">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 登录凭证</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="wsToken" autocomplete="off" class="layui-input"
                                               placeholder="请输入登录凭证" lay-reqText="请输入登录凭证"
                                               tipShow="1" tipMsg="登录凭证">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> SSL证书</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="wsServerSSLCert" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </fieldset>-->

                    <fieldset class="table-search-fieldset">
                        <legend> 有线网络</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">IP地址</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="iIp" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 子网掩码</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="iMask" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> Mac地址</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="iMac" disabled="disabled" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">默认网关</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="iGateway" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> DHCP</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="iDhcp" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> DNS</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="iDns" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">udp端口</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="iUdp" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> TCP端口</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="iTcp" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> webSocket端口</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="iWebsocket" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> webSocket保活间隔时间</label>
                                    <div class="layui-input-inline">
                                        <input type="number" max="7200" min="5" name="iKeepalive" autocomplete="off" class="layui-input"
                                               lay-verify="required" placeholder="请输入webSocket保活包发包间隔" lay-reqText="请输入保活包发包间隔"
                                               tipShow="1" tipMsg="webSocket保活包发包间隔，必填<br/>取值范围： 5 -- 7200，单位：秒">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">启用SSL</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="iSsl" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>

                                </div>

                            </div>
                        </div>

                    </fieldset>
                    <fieldset class="table-search-fieldset">
                        <legend> 无线网络</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 启用无线网络</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="wifiUse" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> WiFi名称</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="wifiName" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> WiFi密码</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="wifiPassword" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> IP地址</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="wifiIp" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 网关</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="wifiMask" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">子网掩码</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="wifiGateway" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </fieldset>
                    <fieldset class="table-search-fieldset">
                        <legend> 操作</legend>
                        <div class="layui-form-item">
                            <div class="layui-inline" style="float:right">
                                <button type="button" class="layui-btn layui-btn-normal"
                                        id="WriteNetwork">
                                    <i class="layui-icon"></i> 写入网络参数
                                </button>
                            </div>
                        </div>

                    </fieldset>
                </div>

                <!-- 其他 -->
                <div class="layui-tab-item" id="device_Update_Page5">
                    <fieldset class="table-search-fieldset">
                        <legend> 记录存储</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">

                                <div class="layui-inline">
                                    <label class="layui-form-label"> 存储陌生人记录</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="saveExternalvisitors" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 保存现场图片</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="savePhoto" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                               
                            </div>

                        </div>

                    </fieldset>
                    <fieldset class="table-search-fieldset">
                        <legend> 功能开关</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">                  
                                <div class="layui-inline">
                                    <label class="layui-form-label"> Web页面开关</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="webLoginSwitch" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 开发者模式开关</label>
                                    <div class="layui-input-inline">
                                        <input type="checkbox" name="linuxLoginSwitch" lay-skin="switch" lay-text="启用|禁用" unchecked value="1">
                                    </div>
                                </div>
                            </div>

                        </div>

                    </fieldset>
                    <fieldset class="table-search-fieldset">
                        <legend> 固件升级</legend>
                        <div class="layui-form-item">
                            <label class="layui-form-label">固件版本:</label>
                            <div class="layui-input-block">
                                <select name="softUpload">
                                </select>
                            </div>
                            <!--<div class="layui-input-inline">
                <button class="layui-btn layui-btn-normal" id="btnUpdateSoft">更新固件</button>
            </div>-->
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block" style="float:right">
                                <button class="layui-btn layui-btn-normal" id="btnUpdateSoft">更新固件</button>
                            </div>
                        </div>


                    </fieldset>
                </div>

                <!-- 状态 -->
                <div class="layui-tab-item" id="device_Update_Page6">
                    <style>
                        .status-black {
                            margin-left: 10px;
                            padding-left: 5px !important;
                            padding-right: 5px !important;
                            color: black;
                        }

                        .status-red {
                            color: red;
                        }

                        .status-blue {
                            color: blue;
                        }

                        .status-MediumSeaGreen {
                            color: mediumSeaGreen;
                        }

                        .status-magenta {
                            color: magenta;
                        }

                        .status-Tomato {
                            color: tomato;
                        }

                        .status-darkred {
                            color: darkred;
                        }
                    </style>
                    <fieldset class="table-search-fieldset">
                        <legend> 在线状态</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 在线状态</label>
                                    <div class="layui-input-inline">
                                        <div class="layui-form-mid status-black" name="onlineStatus"></div>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 最近保活包时间</label>
                                    <div class="layui-input-inline">
                                        <div class="layui-form-mid status-black" name="lastKeepaliveTime" isStaus></div>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 最近连接时间</label>
                                    <div class="layui-input-inline">
                                        <div class="layui-form-mid status-black" name="onlineTime" isStaus></div>
                                    </div>
                                </div>

                            </div>


                        </div>

                    </fieldset>

                    <fieldset class="table-search-fieldset">
                        <legend> 创建及更新时间</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">

                                <div class="layui-inline">
                                    <label class="layui-form-label">创建时间</label>
                                    <div class="layui-input-inline">
                                        <div class="layui-form-mid status-black" name="createTime"></div>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">最后更新时间</label>
                                    <div class="layui-input-inline">
                                        <div class="layui-form-mid status-black" name="lastUpdatetime"></div>
                                    </div>
                                </div>

                            </div>

                            <div class="layui-form-item">

                                <div class="layui-inline">
                                    <label class="layui-form-label">同步状态</label>
                                    <div class="layui-input-inline">
                                        <div class="layui-form-mid status-black" name="uploadStatus"></div>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">同步时间</label>
                                    <div class="layui-input-inline">
                                        <div class="layui-form-mid status-black" name="uploadStatusTime" isStaus></div>
                                    </div>
                                </div>

                            </div>
                        </div>

                    </fieldset>

                    <!--<fieldset class="table-search-fieldset">
                        <legend> 工作状态</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">

                                <div class="layui-inline">
                                    <label class="layui-form-label">系统运行天数</label>
                                    <div class="layui-input-inline">
                                        <div class="layui-form-mid status-black" name="createTime"></div>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">格式化次数</label>
                                    <div class="layui-input-inline">
                                        <div class="layui-form-mid status-black" name="lastUpdatetime"></div>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">看门狗复位次数</label>
                                    <div class="layui-input-inline">
                                        <div class="layui-form-mid status-black" name="uploadStatus"></div>
                                    </div>
                                </div>

                                <div class="layui-form-item">

                                    <div class="layui-inline">
                                        <label class="layui-form-label">后备电源电压</label>
                                        <div class="layui-input-inline">
                                            <div class="layui-form-mid status-black" name="uploadStatus"></div>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">主电源电压</label>
                                        <div class="layui-input-inline">
                                            <div class="layui-form-mid status-black" name="uploadStatusTime" isStaus></div>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">工作环境温度</label>
                                        <div class="layui-input-inline">
                                            <div class="layui-form-mid status-black" name="uploadStatusTime" isStaus></div>
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-form-item">

                                    <div class="layui-inline">
                                        <label class="layui-form-label">继电器物理状态</label>
                                        <div class="layui-input-inline">
                                            <div class="layui-form-mid status-black" name="uploadStatus"></div>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">常开状态</label>
                                        <div class="layui-input-inline">
                                            <div class="layui-form-mid status-black" name="uploadStatusTime" isStaus></div>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">门磁状态</label>
                                        <div class="layui-input-inline">
                                            <div class="layui-form-mid status-black" name="uploadStatusTime" isStaus></div>
                                        </div>
                                    </div>
                                </div>


                                <div class="layui-form-item">

                                    <div class="layui-inline">
                                        <label class="layui-form-label">电锁状态</label>
                                        <div class="layui-input-inline">
                                            <div class="layui-form-mid status-black" name="uploadStatus"></div>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">消息推送状态</label>
                                        <div class="layui-input-inline">
                                            <div class="layui-form-mid status-black" name="uploadStatusTime" isStaus></div>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">报警状态</label>
                                        <div class="layui-input-inline">
                                            <div class="layui-form-mid status-black" name="uploadStatusTime" isStaus></div>
                                        </div>
                                    </div>
                                </div>


                                <div class="layui-form-item">

                                    <div class="layui-inline">
                                        <label class="layui-form-label">开机时间</label>
                                        <div class="layui-input-inline">
                                            <div class="layui-form-mid status-black" name="uploadStatus"></div>
                                        </div>
                                    </div>

                                </div>
                            </div>

                    </fieldset>-->
                </div>

                <div class="layui-tab-item" id="device_Update_Page7">
                    <fieldset class="table-search-fieldset">
                        <legend> 人员存储详情</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 人员存储容量</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="psPerson" autocomplete="off" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 人脸存储容量</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="psFace" autocomplete="off" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 卡片存储容量</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="psCard" autocomplete="off" class="layui-input" disabled>
                                    </div>
                                </div>

                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 密码存储容量</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="psPasword" autocomplete="off" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 指纹存储信息</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="psfp" autocomplete="off" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 管理员存储容量</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="psAdmin" autocomplete="off" class="layui-input" disabled>
                                    </div>
                                </div>

                            </div>
                        </div>

                    </fieldset>

                    <fieldset class="table-search-fieldset">
                        <legend> 记录存储信息</legend>
                        <div style="margin: 3px 3px 3px 3px">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 出入记录存储容量</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="rsRecord" autocomplete="off" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label" tipShow="1" tipMsg="系统及远程操作记录存储容量">系统及远程操作记录存储容量</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="rsSystem" autocomplete="off" class="layui-input" disabled>
                                    </div>
                                </div>

                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"> 报警记录存储容量</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="rsAlarm" autocomplete="off" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label" tipShow="1" tipMsg="门磁、门锁状态记录容量"> 门磁、门锁状态记录容量</label>

                                    <div class="layui-input-inline">
                                        <input type="text" name="rsDoor" autocomplete="off" class="layui-input" disabled>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </fieldset>
                </div>
            </div>

        </div>
    </div>
    <div class="layui-panel" style="text-align: center;" id="device_update_button_div">
        <style>
            #device_update_button_div button {
                width: 150px;
            }
        </style>
        <div style="margin: 5px 5px 5px 5px">
            <!-- 按钮 -->
            <div class="layui-form-item">
                <div class="layui-inline">
                    <button type="button" class="layui-btn layui-btn-normal"
                            id="ReadDeviceInfo">
                        <i class="layui-icon"></i> 从设备读取
                    </button>
                </div>
                <div class="layui-inline">
                    <button type="submit" class="layui-btn layui-btn-normal"
                            lay-submit lay-filter="data-save-btn" id="2">
                        <i class="layui-icon"></i> 保存并写入
                    </button>
                </div>
                <div class="layui-inline">
                    <button type="submit" class="layui-btn layui-btn-danger"
                            id="data-cancel-btn">
                        <i class="layui-icon"></i> 取消
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use(['form', 'laydate', 'element', 'faceAPI'], function () {
        var element = layui.element;
        var form = layui.form;
        var laydate = layui.laydate, $ = layui.$;;
        form.render();

        // 当前弹出层，防止ID被覆盖
        var parentIndex = layer.index;


        var faceAPI = layui.faceAPI;

        if (faceAPI.hasOwnProperty['DevicePageUpdate'] == false) {
            layer.close(parentIndex);
            return;
        }

        if (faceAPI.DevicePageUpdate == null) {
            layer.close(parentIndex);
            return;
        }
        //执行一个laydate实例
        laydate.render({
            elem: '[name="parameterProductionDate"]', //指定元素
            type: 'datetime'
        });

        //开始绑定字段值
        var device = faceAPI.DevicePageUpdate;

        form.val("device_Update_div_filter", device);

        //绑定网络参数字段
        var _page4 = $('#device_Update_Page4');
        _page4.find('div[autoset]').each((ind, em) => {
            var _em = $(em);
            var name = _em.attr("name");
            if (device.hasOwnProperty(name))
                _em.html(device[name]);
        });

        var SwitchTitle = [];
        SwitchTitle[0] = "禁用";
        SwitchTitle[1] = "启用";

        _page4.find('div[name=parameterNetworkSwitch]').html(SwitchTitle[device.parameterNetworkSwitch]);
        _page4.find('div[name=parameterNetworkIpActive]').html(SwitchTitle[device.parameterNetworkIpActive]);
        _page4.find('div[name=parameterWifiSwitch]').html(SwitchTitle[device.parameterWifiSwitch]);



        //绑定状态字段
        var _page6 = $('#device_Update_Page6');
        _page6.find('div[name=createTime]').html(device.createTime);
        _page6.find('div[name=lastUpdatetime]').html(device.lastUpdatetime);

        var uploadStatusTitle = [];
        uploadStatusTitle[0] = '<span class="status-magenta">未同步</span>';
        uploadStatusTitle[1] = '<span class="status-blue">已同步</span>';

        var doorStatusTitle = [];//门状态  0--无门磁；1--门开；2--门关
        doorStatusTitle[0] = '<span>无门磁</span>';
        doorStatusTitle[1] = '<span class="status-blue">门开</span>';
        doorStatusTitle[2] = '<span class="status-MediumSeaGreen">门关</span>';

        var alarmStatusTitle = [];//设备报警状态  0--无报警；1--消防报警；2--门磁报警；3--开门超时报警；4--黑名单报警
        alarmStatusTitle[0] = '<span>无报警</span>';
        alarmStatusTitle[1] = '<span class="status-red">消防报警</span>';
        alarmStatusTitle[2] = '<span class="status-red">门磁报警</span>';
        alarmStatusTitle[3] = '<span class="status-Tomato">开门超时报警</span>';
        alarmStatusTitle[4] = '<span class="status-darkred">黑名单报警</span>';

        ShowOnlineStatus(device);

        //显示在线状态
        function ShowOnlineStatus(status) {
            _page6.find('div[isStaus]').each((ind, em) => $(em).html(status[$(em).attr("name")]));


            var onlineTime = dayjs(status.onlineTime, "YYYY-MM-DD HH:mm:ss");
            second = dayjs().diff(onlineTime, 'second');
            if (second < 30) {
                _page6.find('div[name=onlineStatus]').html('<span class="label label_online">在线</span>');

                _page6.find('div[name=doorStatus]').html(doorStatusTitle[status.doorStatus]);
                _page6.find('div[name=alarmStatus]').html(alarmStatusTitle[status.alarmStatus]);

            }
            else {
                _page6.find('div[name=onlineStatus]').html('<span class="label label_offline">离线</span>');
                _page6.find('div[name=doorStatus]').html("");
                _page6.find('div[name=alarmStatus]').html("");
            }



            _page6.find('div[name=uploadStatus]').html(uploadStatusTitle[status.uploadStatus]);
            if (status.uploadStatus == 0)
                _page6.find('div[name=uploadStatusTime]').html("");

        }

        //监听测试
        $('#data-cancel-btn').on('click', function () {
            layer.close(parentIndex);
        });

        $("#WriteNetwork").click(function () {
            debugger
            var data = {};
            data.DeviceId = $("#id").val();
            var netWorkform = $("#device_Update_Page4 input").serializeArray();
            $.each(netWorkform, function () {
                data[this.name] = this.value;
            });
           
            var index = layer.load(1, {
                shade: [0.5, '#fff'] //0.1透明度的白色背景
            });
            faceAPI.Ajax({
                type: 'Post',
                data: data,
                url: '/api/FaceDeviceNew/WriteNetWork',
                success: function (result) {
                    if (result.result == false) {
                        layer.alert(result.error, { icon: 2 });
                    }
                    else {
                        layer.alert('写入成功：', { icon: 1 });
                    }
                    layer.close(index);
                }
            });
        });


        //监听提交
        form.on('submit(data-save-btn)', function (data) {
            var postdata = data.field;

            //       if (data.elem.id == "2") {
            SaveData(postdata);

            return false;
        });
        //保存并提交数据
        function SaveData(postdata) {
            var index = layer.load(1, {
                shade: [0.5, '#fff'] //0.1透明度的白色背景
            });
            faceAPI.Ajax({
                type: 'Post',
                data: postdata,
                url: '/api/FaceDeviceNew/UpdateDeviceDetail',
                success: function (result) {
                    if (result.result == false) {
                        layer.alert(result.error, { icon: 2 });
                    }
                    else {
                        faceAPI.DevicePageUpdateResult = result;
                        // postdata.deviceID = device.deviceID;
                        faceAPI.DevicePageUpdateResult.content = postdata;
                        layer.close(parentIndex);
                        layer.alert('写入成功：', { icon: 1 });
                    }
                    layer.close(index);
                }
            });
        }
        $("#ReadDeviceInfo").click(function () {
            //    debugger;
            var index = layer.load(1, {
                shade: [0.5, '#fff'] //0.1透明度的白色背景
            });
            var id = $("#id").val();
            faceAPI.Ajax({
                type: 'Get',
                url: '/api/FaceDeviceNew/ReadDeviceDetail/' + id,
                success: function (result) {
                    if (result.result == false) {
                        layer.alert(result.error, { icon: 2 });
                    }
                    else {
                        form.val("device_Update_div_filter", result.content);
                        layer.alert("读取成功", { icon: 1 });
                    }
                    layer.close(index);
                }
            });
        })
        ////启动一个定时刷新任务
        //var iIntervalID = setInterval(() => {
        //    if (faceAPI.DeviceUpdateIntervalID != iIntervalID) {
        //        clearInterval(iIntervalID);
        //        return;
        //    }
        //    if ($("[lay-filter=device_Update_div_filter]").length == 0) {
        //        clearInterval(iIntervalID);
        //        faceAPI.DeviceUpdateIntervalID = 0;
        //        return;
        //    }
        //    faceAPI.Ajax({
        //        type: 'Post',
        //        data: { SNList: [device.deviceID] },
        //        url: '/api/FaceDevice/GetDeviceOnlineStatus',
        //        success: function (result) {
        //            if (result.result == false) {
        //                layer.alert(result.error, { icon: 2 });
        //            }
        //            else {
        //                ShowOnlineStatus(result.content[0]);
        //                //
        //            }

        //        }
        //    });
        //}, 3000);
        //faceAPI.DeviceUpdateIntervalID = iIntervalID;

        $("[lay-filter=device_Update_div_filter] [tipShow=1]").mouseenter(input_mouseenter);
        $("[lay-filter=device_Update_div_filter] [tipShow=1]").mouseleave(() => {
            if (iMouseenter_TipIndex > 0)
                layer.close(iMouseenter_TipIndex);
        });
        // 输入框 值范围提示
        var iMouseenter_TipIndex = 0;
        function input_mouseenter() {
            var that = this;
            if (iMouseenter_TipIndex > 0)
                layer.close(iMouseenter_TipIndex);
            var em = $(that);
            var msg = em.attr("tipMsg");

            iMouseenter_TipIndex = layer.tips(msg, that);
        }


        //固件更新相关函数
        var softsetting = null;
        faceAPI.Ajax({
            type: 'Get',
            url: '/softpkg/softsetting.json',
            success: function (result) {

                try {
                    var em = $("select[name=softUpload]");
                    var sHtml = [];
                    softsetting = result.list;
                    //<option value="0" selected>常闭</option>
                    softsetting.forEach(function (item, index, arr) {
                        var sopt = '<option value="' + item.name + '" ';
                        //sopt = sopt + ' itemver="' + item.ver + '" ';
                        //sopt = sopt + ' itemmd5="' + item.name + '" ';
                        sopt = sopt + '>' + item.name + '</option>';
                        //console.log(sopt);

                        sHtml.push(sopt);
                    });
                    em.html(sHtml.join(''));
                    form.render('select');
                } catch (e) {

                }
            }
        });

        $('#btnUpdateSoft').on('click', function () {
            if (softsetting == null) return false;

            var values = form.val("device_Update_div_filter");
            var selectValue = values.softUpload;

            softsetting.forEach(function (item, index, arr) {
                if (item.name == selectValue) {
                    debugger
                    var postdata = {};
                    postdata.SoftName = item.url;
                    postdata.Ver = item.ver;
                    postdata.SoftMD5 = item.md5;
                    postdata.DeviceID = device.id;
                    //提交更新
                    faceAPI.Ajax({
                        type: 'Post',
                        data: postdata,
                        url: '/api/FaceDeviceNew/UpdateDeviceSoft',
                        success: function (result) {
                            if (result.result == false) {
                                layer.alert(result.error, { icon: 2 });
                            }
                            else {

                                layer.close(parentIndex);
                            }

                        }
                    });

                }
            });
            //console.log( values.softUpload);
            return false;
        });
    });
</script>
